package com.xl.rentkeeper.util;

import com.xl.rentkeeper.log.QLog;

/**
 * Created by zjm on 2015/1/5.
 */
public class SLog {
    String tag;
    boolean debug;
    public SLog(Object obj,boolean debug) {
        this.tag = obj.getClass().getSimpleName();
        this.debug = debug;
    }

    public SLog(String obj,boolean debug, boolean isTagName) {
        this.tag = obj;
        this.debug = debug;
    }

    public void log(String msg) {
        if (debug) {
            QLog.d(tag, msg);
        }
    }

    public void log(String msg,Throwable e) {
        if (debug) {
            QLog.d(tag, msg,e);
        }
    }

    public void log(String fmt, Object... args) {
        if (debug) {
            String msg = String.format(fmt,args);
            QLog.d(tag,msg);
        }
    }

    public void log(String fmt, Throwable e,Object... args) {
        if (debug) {
            String msg = String.format(fmt,args);
            QLog.d(tag,msg,e);
        }
    }
}
